/**************************************************************************
 * MODULE NAME:    l2_channel.h
 * PROJECT CODE:
 * DESCRIPTION:    L2CAP Channel manipulation functions
 * AUTHOR:         Gary Fleming
 * DATE:           20-07-2000
 *
 * SOURCE CONTROL: $Id: l2_channel.h,v 1.2 2008/12/16 10:20:39 jianguo Exp $
 *
 * LICENSE:
 *     This source code is copyright (c) 2000 RDA Microelectronics, Ltd.
 *     All rights reserved.
 *
 **************************************************************************/

#ifndef __RDA_L2CAP_CHANNEL
#define __RDA_L2CAP_CHANNEL

#include "l2_types.h"

extern rdabt_t_l2_channel*  rdabt_l2_channel_list[];

rdabt_t_l2_channel* rdabt_l2_chn_tid2channel(u_int8 identifier);
rdabt_t_l2_channel* rdabt_l2_chn_get_p_channel(u_int16 cid);
rdabt_t_l2_channel* rdabt_l2_chn_alloc_channel(void);

#if AMP_MANAGER_SUPPORT==1
rdabt_t_l2_channel * rda_l2_alloc_fixed_channel(t_channelId  cid);
#endif

int rdabt_l2_chn_handle_in_use(u_int16 handle);

u_int8 rdabt_l2_chn_set_qos(rdabt_t_l2_channel* p_channel,t_L2_ChannelFlowSpec *outflow);
void rdabt_l2_chn_free_channels_on_handle(u_int16 handle);
void rdabt_l2_chn_free_channels_on_psm(u_int16 psm);
void rdabt_l2_chn_free_channel(rdabt_t_l2_channel* p_channel, u_int8 release_acl);
void  rdabt_l2_chn_data_error_for_channels_on_handle(u_int16 handle,u_int8 data_error);

/***************************************************
 *  methods for L2CAP Channel timers.
 ***************************************************/

void rdabt_l2_chn_start_RTX_timer(rdabt_t_l2_channel* p_channel);
void rdabt_l2_chn_disable_RTX_timer(rdabt_t_l2_channel* p_channel);
void rdabt_l2_chn_start_ERTX_timer(rdabt_t_l2_channel* p_channel);
void rdabt_l2_chn_disable_ERTX_timer(rdabt_t_l2_channel* p_channel);
void rdabt_l2_chn_timer_expired(void *arg);

void rdabt_l2_chn_stop_cfg_timer(rdabt_t_l2_channel* p_channel);
void rdabt_l2_chn_start_cfg_timer(rdabt_t_l2_channel* p_channel);

#endif
